package com.ldzy.webase.service.impl;

import com.ldzy.webase.dao.TodayCuisineMapper;
import com.ldzy.webase.entity.TodayCuisine;
import com.ldzy.webase.exception.ExceptionResponse;
import com.ldzy.webase.exception.ExceptionResponseCode;
import com.ldzy.webase.service.TodayCuisineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Lq
 * @version ：1.0
 * @date ：2022/11/16 10:55
 * @description ：t_todaycuisine-今日菜系表-业务层
 */
@Service
public class TodayCuisineServiceImpl implements TodayCuisineService {
    @Autowired
    TodayCuisineMapper todayCuisineMapper;

    /**
     * @author ：Lq
     * @date ：2022/11/16 11:11
     * @description ：查询今日菜系所有菜品-可根据今日24小时查询新上新菜品
     */
    @Override
    public List<TodayCuisine> getAllTodayCuisine(Boolean is24Hour) {
        List<TodayCuisine> todayCuisineList = todayCuisineMapper.getAllTodayCuisine(is24Hour);


        if (todayCuisineList == null || todayCuisineList.size() == 0) {
            throw ExceptionResponse.build(ExceptionResponseCode.ERROR_NOT_DATA); // (401, "无数据")
        }

        return todayCuisineList;
    }
}
